<template>
  <div class="item" @click="toStore">
    <img :src="itemContent.pic" />
    <div class="item-right">
      <div class="title">{{ itemContent.title }}</div>
      <div class="sales">
        月销<span>{{ itemContent.sales }}</span>
      </div>
      <div class="price">
        起送<span>￥{{ itemContent.price }}</span
        >免配送费
      </div>
      <div class="label">
        <div v-for="(item, index) in itemContent.label" :key="index">
          {{ item }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";

export default {
  name: "NavListItem",
  props: ["itemContent"],
  setup() {
    const router = useRouter();
    const toStore = () => {
      router.push("/store");
    };
    return {
      toStore,
    };
  },
};
</script>

<style lang="scss" scoped>
.item {
  display: flex;
  padding: 10px;
  margin-top: 10px;
  background-color: #fff;
  border-radius: 10px;
  img {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    margin-right: 20px;
  }
  .item-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 12px;
    .title {
      font-size: 18px;
    }
    .sales {
      span {
        padding-left: 5px;
      }
    }
    .price {
      span {
        padding: 0 5px;
      }
    }
    .label {
      display: flex;
      div {
        padding: 2px 5px;
        // margin-right: 5px;
        background-color: #ffc300;
        border-radius: 5px;
      }
      div:nth-child(2) {
        margin-left: 10px;
      }
    }
  }
}
</style>
